package slxy.jiangtao.dts.entity.sys;

import org.hibernate.annotations.DynamicInsert;
import slxy.jiangtao.dts.core.common.bean.BaseId;

import javax.persistence.*;
import java.util.List;

/**
 * Code must be sexy
 * Created by JiangTao on 2017/1/12.
 */
@Entity
@Table(name = "menu")
@DynamicInsert
public class Menu extends BaseId {
    public Menu(){}
    /**
     * 菜单名称
     */
    @Column(name = "name",nullable = false)
    private String name;

    /**
     * 菜单图标
     */
    @Column(name = "icon")
    private String icon;

    /**
     * 菜单链接
     */
    @Column(name = "url")
    private String url;

    /**
     * 菜单等级
     */
    @Column(name = "level")
    private Integer level;

    /**
     * 菜单排序
     */
    @Column(name = "sequence")
    private Integer sequence;

    /**
     * 父级菜单ID
     */
    @Column(name = "parent_id")
    private Integer parentId;

    /**
     * 子菜单
     */
    /*@OneToMany(cascade = CascadeType.ALL, mappedBy = "parentId", fetch = FetchType.LAZY)
    @OrderBy("sequence")
    private List<Menu> childrens;*/


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }


    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public Integer getSequence() {
        return sequence;
    }

    public void setSequence(Integer sequence) {
        this.sequence = sequence;
    }


    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

/*    public List<Menu> getChildrens() {
        return childrens;
    }

    public void setChildrens(List<Menu> childrens) {
        this.childrens = childrens;
    }*/
}
